Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Issue 6470: Preserve Space after colon if followed by absolute path declaration (::) #6475

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

FwP-IDN
Copy link
Contributor

@FwP-IDN FwP-IDN commented Feb 12, 2025

Close #6470

@FwP-IDN FwP-IDN changed the title add change, and testcase Fix Issue 6470: Preserve Space after colon if after space is absolute path crate declaration Feb 12, 2025
@FwP-IDN FwP-IDN changed the title Fix Issue 6470: Preserve Space after colon if after space is absolute path crate declaration Fix Issue 6470: Preserve Space after colon if followed by absolute path declaration (::) Feb 13, 2025
src/items.rs Outdated
Comment on lines 2297 to 2323
result.push_str(colon_spaces(context.config));
result.push_str(colon_spaces(context.config, false));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why we can pass false here? It would also be helpful if you could add an explanation to the other call sites where you've passed false.

Copy link
Contributor

@ytmimi ytmimi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another cases that we should test:

fn func<T: ::some::Trait>(x: T) {}

@FwP-IDN FwP-IDN requested a review from ytmimi February 18, 2025 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rustfmt can generate invalid code when using space_after_colon=false
3 participants